<?php

require_once("main.php");

//print_r($_SESSION);
//exit;

//require_once(DIR_LIB."ShoppingCenter".DIR_SEP."scborder.php");


// Form Processing
//===============================================================================================



// Init Model
//===============================================================================================
//$listOrders = ScbOrder::makeOrders();


// Init VIEW
//===============================================================================================
require_once("templates/scbpage.php");

$page = ScbPage::Instance();

require_once(dirname(__FILE__).DIR_SEP."templates".DIR_SEP."XCart".DIR_SEP."xcart_wrapper_print.php");

//require_once(dirname(__FILE__).DIR_SEP."templates".DIR_SEP."XCart".DIR_SEP."xcart_models.php");
//require_once(dirname(__FILE__).DIR_SEP."templates".DIR_SEP."XCart".DIR_SEP."xcart_operations.php");
require_once(dirname(__FILE__).DIR_SEP."templates".DIR_SEP."XCart".DIR_SEP."xcart_operators.php");

$wrapper = new XCartWrapperPrint($page);


if($_GET['view']=='work_summery') {
	require_once(dirname(__FILE__).DIR_SEP."templates".DIR_SEP."XCart".DIR_SEP."xcart_operators_work_summary_print.php");
	require_once(dirname(__FILE__).DIR_SEP."templates".DIR_SEP."XCart".DIR_SEP."xcart_operator_work_print.php");
	$page->setTitle("Заработка");

	if(isset($_POST['print_summary']) && $_POST['print_summary']=='on') {
		$form = new XCartOperatorsWorkSummaryPrint($page, $_GET['group']);
		$wrapper->addCentralWdget($form->show());
	}

	if(isset($_POST['op_ids']) && is_array($_POST['op_ids'])) {
		foreach($_POST['op_ids'] as $k=>$v) {
			$form = new XCartOperatorWorkPrint($page, $k);
			$wrapper->addCentralWdget($form->show());
		}
	}
}
// Operator Work Razbito po Belejki
else if($_GET['view']=='operator_work') {
	require_once(dirname(__FILE__).DIR_SEP."templates".DIR_SEP."XCart".DIR_SEP."xcart_operator_work_print.php");

	$form = new XCartOperatorWorkPrint($page, $_GET['op_id']);
	$wrapper->addCentralWdget($form->show());
}
else if($_GET['view']=='operator_work_grouped') {
	require_once(dirname(__FILE__).DIR_SEP."templates".DIR_SEP."XCart".DIR_SEP."xcart_operator_work_print.php");

	$form = new XCartOperatorWorkPrint($page, $_GET['op_id']);
	$wrapper->addCentralWdget($form->show());
}
else if($_GET['view']=='work_count') {
	require_once(dirname(__FILE__).DIR_SEP."templates".DIR_SEP."XCart".DIR_SEP."xcart_operations_work_count.php");

	$page->setTitle("Изработени Бройки по Операции");

	$form = new XCartOperationsWorkCount($page, $_REQUEST['modid'], TRUE);
	$wrapper->addCentralWdget($form->show());
}

//$wrapper->addCentralWdget($form->show());

$page->addWidget($wrapper);

//$page->addCssFile("templates/XCart/css/print.css", 'print');
$page->show();


// EXIT
//================================================================================================


?>
